<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<%@ include file="/common/import.jsp" %>
<script>
  var thsTitle = "竞价统计";
  var objName="itemHistory";
  var currentObjId = "";
</script>
<script type="text/javascript" src="${ctx}/js/zbxupload.js"></script> 
<title>竞价统计-${sysName}</title>
</head>
<body class="home-template">
<!-- 正文开始 -->
<div class="searchForm"><form id="endList_form">
	<input type="hidden" name="page"  value="1">
	<input type="hidden" name="rows"  value="10">
	标的名称：<input type="text" name="itemName"  value="" /> &nbsp;&nbsp;&nbsp;
	活动名称：<input type="text" name="sessionName"  value="" /> &nbsp;&nbsp;&nbsp;
	报价方向：<select name="direction" style="width:120px;">
	         <option value="">------请选择------</option>
			 <option value="T">正向</option>
			 <option value="F">反向</option>
			</select>
	<a class="easyui-linkbutton"  iconCls="icon-search" onclick="endListSearch();">查询</a>
	<a class="easyui-linkbutton"  onclick="clearFormById('endList_form');">清空</a>
</form></div>
<table id="endList_table" class="info" cellspacing="1" cellpadding="0">
		<tr class='active' id="title2" >
			<th width='15%'>标的名称</th>
			<th width='13%'>所属活动</th>
			<th width='5%'>起始价格</th>
			<th width='5%'>报价次数</th>
			<th width='5%'>最高报价</th>
			<th width='5%'>溢价率</th>
			<th width='8%'>报价方式</th>
			<th width='13%'>结束时间</th>		
			<th width='5%'>是否交割</th>	
			<th width='5%'>是否通知</th>	
			<th width='15%' class='th_center'>操作</th>
		</tr>
	</table>
	<div id="endList_page" class="page"></div>
	<script type="text/template" id="endList_html">
	<? for ( var i = 0; i < rows.length; i++) {?>
		<tr id=item_<?=rows[i].itemId?>>
			<td title=<?=rows[i].itemName?> ><?=strUtil.subStr(rows[i].itemName,12)?></td>
            <td title=<?=rows[i].sessionName?>><?=strUtil.subStr(rows[i].sessionName,10)?></td>
			<td><?=rows[i].firstValue?></td>
			<td><?=rows[i].bidTimes?></td>
			<td><?=rows[i].lastValue?></td>
			<td><?=rows[i].yjl?></td>
			<td><?=bidModeText(rows[i].bidMode)?>(<?=directionText(rows[i].direction)?>)</td>
			<td><?=rows[i].closeTime?></td>
            <td><?=itemStatusText(rows[i].itemStatus)?></td>
			<td><?=msgStatusText(rows[i].msgStatus)?></td>
			<td>
				<a class="mybutton"  onclick="restoreItem('<?=rows[i].itemId?>');">恢复</a> 
                <?if(rows[i].itemStatus==1){?>				
					|| <a class="mybutton"  >交割</a>
				<?}?>
				<?if(rows[i].msgStatus==1){?>				
					|| <a class="mybutton" >通知</a>
				<?}?>
				<?if(rows[i].bidMode>0){?>				
					|| <a class="mybutton"  onclick="viewRecord('<?=rows[i].itemId?>','<?=rows[i].bidMode?>');">报价记录</a>
				<?}?>
			</td>
		</tr>
	<?}?>  		
	</script>	
<!-- 正文结束 -->
<%@ include file="/common/top.jsp" %>
<!-- dialog1 查看报价记录 -->
<div id="jinjiaRecord_window" class="easyui-dialog" title="查看报价记录" modal="true" style="width:800px;height:400px" closed="true">
	<div class="searchForm"><form id="jinjiaRecord_form">
		<input type="hidden" name="page" value="1">
		<input type="hidden" name="rows" value="5">
		<input type="hidden" name="itemId" value="">
		报价人：<input type="text" name="userName"  value="" /> 
		<a class="easyui-linkbutton"  iconCls="icon-search" onclick="jinjiaRecordSearch();">查询</a>
	</form></div>
	<table id="jinjiaRecord_table" class="info" cellspacing="1" cellpadding="0">
		<tr class='active' id="title2" >
			<th width='5%'>报价序号</th>
			<th width='20%'>报价人</th>
			<th width='10%'>报价价格</th>	
			<th width='20%'>报价时间</th>
			<th width='10%'>增幅</th>
			<th width='15%'>报价人IP</th>
		</tr>
	</table>
	<div id="jinjiaRecord_page" class="page"></div>
	<script type="text/template" id="jinjiaRecord_html">
	<? for ( var i = 0; i < rows.length; i++) {?>
		<tr>
			<td><?=rows.length-i?></td>
			<td><?=rows[i].userName?></td>
			<td><?=rows[i].bidValue?></td>
			<td><?=rows[i].bidTime.substring(0,19)?></td>
			<td><?=rows[i].incValue?></td>
			<td><?=rows[i].userIp?></td>
		</tr>
	<?}?>  		
	</script>
</div>
</body>
</html>

<script>

function restoreItem(itemId){
	if(confirm("此操作请慎重使用，确定要恢复吗？")){
		alert(itemId);
		restoreItemSubmit(itemId);
	}	
}
function restoreItemBack(flag,msg){
	if(flag=="T"){
		endListSearch();
	}else{
		alert("发布失败，"+msg);
	}
}

function viewRecord(itemId,bidMode){
	$("#jinjiaRecord_form").find("input[name='itemId']").val(itemId);
	jinjiaRecordSearch(bidMode);
	$("#jinjiaRecord_window").dialog("open");
}

//竞买人查询
function jinjiaRecordSearch(bidMode){
    if(bidMode == '1' || bidMode == '2' || bidMode == '7'){
      searchSubmit("jingjia","jinjiaRecord");
    }else if(bidMode == '3' || bidMode == '4' || bidMode == '5' || bidMode == '6' ){
      searchSubmit("baojia","jinjiaRecord");
    }
}

function directionText(direction){
	if("T"==direction)
		return "正向";
	else
		return "反向";
}
function msgStatusText(msgStatus){
	if("1"==msgStatus)
		return "否";
	else
		return "是";
}
function itemStatusText(itemStatus){
	if("1"==itemStatus)
		return "否";
	else
		return "是";
}
function bidModeText(bidMode){
	var btext = "--";
	if(bidMode=="1" || bidMode=="2")btext = "多次竞价";
	if(bidMode=="3" || bidMode=="4")btext = "一次报价";
	if(bidMode=="5" || bidMode=="6")btext = "份额报价";
	if(bidMode=="7")btext = "荷兰式竞价";
	return btext;
}

//查询提交
function endListSearch(){
	searchSubmit(objName,"endList");
}

//初始化加载
$(function(){
	//加载分页列表
	endListSearch();
});

</script>

